<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   主题：关于用四种方法做出岭回归，我跪了，2*SPSS+2*R  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
   MathJax.Hub.Config({elements: ["bbpress-forums"]});
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://cos.name/cn/topic/108769/",
                  host: "http://cos.name",
                  prePath: "http://cos.name",
                  scheme: "http",
                  pathBase: "http://cos.name/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466441165: Accept with keywords: (title(0.2):岭,回归,主题,方法,论坛, topn(0.166666666667):RSS订阅,软件应用,帖子,步长,作者,会员,因子分析,创作者,用户名,的用,结果,主站,指导,新鲜事,尼玛,精算,普通,数据组织,方法,回归,差异,密码,总计,作图,主题,算法,奇葩,论坛,R语言,讨论区).-->
 </head>
 <body class="topic bbpress single single-topic postid-108769 single-author sidebar" onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    主题：关于用四种方法做出岭回归，我跪了，2*SPSS+2*R
   </h1>
  </div>
  <div class="container" id="xmain">
   <div class="hfeed site" id="page">
    <header class="site-header" id="masthead" role="banner">
     <div id="cos-logo">
      <a href="http://cos.name/cn">
       <img src="http://cos.name/cn/wp-content/themes/COS-forest/images/headers/cos-logo.png"/>
      </a>
     </div>
     <div class="navbar" id="navbar">
      <nav class="navigation main-navigation" id="site-navigation" role="navigation">
       <h3 class="menu-toggle">
        菜单
       </h3>
       <div class="menu-%e8%8f%9c%e5%8d%951-container">
        <ul class="nav-menu" id="menu-%e8%8f%9c%e5%8d%951">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-407772" id="menu-item-407772">
          <a href="http://cos.name/cn/">
           论坛首页
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407773" id="menu-item-407773">
          <a href="http://cos.name/cn/forums/">
           讨论区
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407774" id="menu-item-407774">
          <a href="http://cos.name/cn/wp-login.php?action=register">
           注册
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407819" id="menu-item-407819">
          <a href="http://cos.name/">
           主站
          </a>
         </li>
        </ul>
       </div>
      </nav>
      <!-- #site-navigation -->
     </div>
     <!-- #navbar -->
    </header>
    <!-- #masthead -->
    <div class="site-main" id="main">
     <div class="content-area" id="primary">
      <div class="site-content" id="content" role="main">
       <article class="post-108769 topic type-topic status-publish hentry" id="post-108769">
        <header class="entry-header">
         <h1 class="entry-title">
          关于用四种方法做出岭回归，我跪了，2*SPSS+2*R
         </h1>
        </header>
        <!-- .entry-header -->
        <div class="entry-content">
         <div id="bbpress-forums">
          <div class="bbp-breadcrumb">
           <p>
            <a class="bbp-breadcrumb-home" href="http://cos.name/cn/">
             COS论坛 | 统计之都
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-root" href="http://cos.name/cn/forums/">
             讨论区
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/">
             软件应用
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/r-language/">
             S-Plus &amp; R语言
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <span class="bbp-breadcrumb-current">
             关于用四种方法做出岭回归，我跪了，2*SPSS+2*R
            </span>
           </p>
          </div>
          <div class="bbp-template-notice info">
           <p class="bbp-topic-description">
            该主题包含 3 条回复，4个帖子，最后由
            <a class="bbp-author-avatar" href="http://cos.name/cn/profile/380287/" rel="nofollow" title="查看sonicworm的档案">
             <img src="http://sdn.geekzu.org/avatar/2cb0958d4b6f968785aa465f64f5ba98?s=14&amp;d=monsterid&amp;r=g"/>
            </a>
            <a class="bbp-author-name" href="http://cos.name/cn/profile/380287/" rel="nofollow" title="查看sonicworm的档案">
             sonicworm
            </a>
            在
            <a href="http://cos.name/cn/topic/108769/#post-348224" title="回复：关于用四种方法做出岭回归，我跪了，2*SPSS+2*R">
             3 年 之前
            </a>
            更新。
           </p>
          </div>
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 4 个帖子 - 1 到 4（总计 4 个）
           </div>
           <div class="bbp-pagination-links">
           </div>
          </div>
          <ul class="forums bbp-replies" id="topic-108769-replies">
           <li class="bbp-header">
            <div class="bbp-reply-author">
             作者
            </div>
            <!-- .bbp-reply-author -->
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-header -->
           <li class="bbp-body">
            <div class="bbp-reply-header" id="post-108769">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年11月30日 下午6:32
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108769/#post-108769">
               1 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-108769 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108769 bbp-reply-position-1 user-id-377850 topic-author post-108769 topic type-topic status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/377850/" rel="nofollow" title="查看陈 森的档案">
               <img src="http://sdn.geekzu.org/avatar/5254ae54235a13a96b28eb63b5d35851?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/377850/" rel="nofollow" title="查看陈 森的档案">
               陈 森
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               作为一个学精算的是不是不应该纠结这些问题
              </p>
              <p>
               数据如下：
              </p>
              <p>
               分行编号 y x1 x2 x3 x4
               <br/>
               1 0.9 67.3 6.8 5 51.9
               <br/>
               2 1.1 111.3 19.8 16 90.9
               <br/>
               3 4.8 173 7.7 17 73.7
               <br/>
               4 3.2 80.8 7.2 10 14.5
               <br/>
               5 7.8 199.7 16.5 19 63.2
               <br/>
               6 2.7 16.2 2.2 1 2.2
               <br/>
               7 1.6 107.4 10.7 17 20.2
               <br/>
               8 12.5 185.4 27.1 18 43.8
               <br/>
               9 1 96.1 1.7 10 55.9
               <br/>
               10 2.6 72.8 9.1 14 64.3
               <br/>
               11 0.3 64.2 2.1 11 42.7
               <br/>
               12 4 132.2 11.2 23 76.7
               <br/>
               13 0.8 58.6 6 14 22.8
               <br/>
               14 3.5 174.6 12.7 26 117.1
               <br/>
               15 10.2 263.5 15.6 34 146.7
               <br/>
               16 3 79.3 8.9 15 29.9
               <br/>
               17 0.2 14.8 0.6 2 42.1
               <br/>
               18 0.4 73.5 5.9 11 25.3
               <br/>
               19 1 24.7 5 4 13.4
               <br/>
               20 6.8 139.4 7.2 28 64.3
               <br/>
               21 11.6 368.2 16.8 32 163.9
               <br/>
               22 1.6 95.7 3.8 10 44.5
               <br/>
               23 1.2 109.6 10.3 14 67.9
               <br/>
               24 7.2 196.2 15.8 16 39.7
               <br/>
               25 3.2 102.2 12 10 97.1
              </p>
              <p>
               一、 有《应用回归分析》里面的方法在SPSS的脚本窗口运行如下代码：
              </p>
              <p>
               INCLUDE’C:\Program Files\IBM\SPSS\Statistics\20\Samples\English\Ridge regression.sps’.
              </p>
              <p>
               RIDGEREG DEP=y/ENTER x1 x2 x3 x4
              </p>
              <p>
               得到是：
              </p>
              <p>
               R-SQUARE AND BETA COEFFICIENTS FOR ESTIMATED VALUES OF K
              </p>
              <p>
               K        RSQ         x1          x2          x3          x4
              </p>
              <p>
               ______    ______    ________    ________    ________    ________
              </p>
              <p>
               .00000    .79760     .891313     .259817     .034471    -.324924
              </p>
              <p>
               .05000    .79088     .713636     .286611     .096624    -.233765
              </p>
              <p>
               .10000    .78005     .609886     .295901     .126776    -.174056
              </p>
              <p>
               .15000    .76940     .541193     .297596     .143378    -.131389
              </p>
              <p>
               .20000    .75958     .491935     .295607     .153193    -.099233
              </p>
              <p>
               .25000    .75062     .454603     .291740     .159210    -.074110
              </p>
              <p>
               .30000    .74237     .425131     .286912     .162925    -.053962
              </p>
              <p>
               .35000    .73472     .401123     .281619     .165160    -.037482
              </p>
              <p>
               .40000    .72755     .381077     .276141     .166401    -.023792
              </p>
              <p>
               .45000    .72077     .364000     .270641     .166949    -.012279
              </p>
              <p>
               .50000    .71433     .349209     .265211     .167001    -.002497
              </p>
              <p>
               .55000    .70816     .336222     .259906     .166692     .005882
              </p>
              <p>
               .60000    .70223     .324683     .254757     .166113     .013112
              </p>
              <p>
               .65000    .69649     .314330     .249777     .165331     .019387
              </p>
              <p>
               .70000    .69093     .304959     .244973     .164397     .024860
              </p>
              <p>
               .75000    .68552     .296414     .240345     .163346     .029654
              </p>
              <p>
               .80000    .68024     .288571     .235891     .162207     .033870
              </p>
              <p>
               .85000    .67508     .281331     .231605     .161000     .037587
              </p>
              <p>
               .90000    .67003     .274614     .227480     .159743     .040874
              </p>
              <p>
               .95000    .66508     .268353     .223510     .158448     .043787
              </p>
              <p>
               1.0000    .66022     .262494     .219687     .157127     .046373
              </p>
              <p>
               二、SPSS的点选 Analyze/Regression/Optimal Scaling
              </p>
              <p>
               Ridge Coefficients
               <br/>
               x1 x2 x3 x4
               <br/>
               1 .942 .213 .213 -.346
               <br/>
               2 .743 .248 .249 -.278
               <br/>
               3 .627 .286 .240 -.235
               <br/>
               4 .560 .302 .229 -.196
               <br/>
               5 .511 .306 .221 -.164
               <br/>
               6 .476 .307 .215 -.138
               <br/>
               7 .453 .301 .209 -.116
               <br/>
               8 .432 .296 .206 -.098
               <br/>
               9 .411 .292 .205 -.082
               <br/>
               10 .393 .287 .203 -.069
               <br/>
               11 .377 .282 .201 -.059
               <br/>
               12 .366 .277 .200 -.052
               <br/>
               13 .355 .272 .198 -.045
               <br/>
               14 .346 .267 .196 -.039
               <br/>
               15 .337 .263 .194 -.034
               <br/>
               16 .329 .258 .192 -.029
               <br/>
               17 .321 .254 .190 -.025
               <br/>
               18 .314 .250 .188 -.021
               <br/>
               19 .308 .246 .186 -.018
               <br/>
               20 .301 .242 .184 -.015
               <br/>
               21 .295 .238 .182 -.012
              </p>
              <p>
               如果把k值加到2，还会奇葩的事情发生：
              </p>
              <p>
               是的它竟然断裂了。
              </p>
              <p>
               三、当然在R中还可以自己算，MASS包里面有个lm.rideg的函数，好像算出来也不大对，下面是我自己手工算的。有兴趣的可以看下我的算法有没错误。
              </p>
              <p>
               ridge&lt;-function(y,x,start,end,step)##岭回归##
               <br/>
               {
               <br/>
               k&lt;-seq(start,end,step)
               <br/>
               n&lt;-length(k)
               <br/>
               m&lt;-length(diag(t(x)%*%x))
               <br/>
               beta&lt;-NULL
               <br/>
               CID&lt;-NULL
               <br/>
               Rs&lt;-NULL
               <br/>
               for(i in 1:n)
               <br/>
               {
               <br/>
               beta&lt;-rbind(beta,t(solve((t(x)%*%x+k
               <em class="d4pbbc-italic">
               </em>
               *diag(m)))%*%t(x)%*%y))
               <br/>
               a&lt;-solve((t(x)%*%x+k
               <em class="d4pbbc-italic">
               </em>
               *diag(m)))%*%t(x)%*%x%*%solve(t(x)%*%x+k
               <em class="d4pbbc-italic">
               </em>
               *diag(m))
               <br/>
               b&lt;-diag(a)
               <br/>
               ssr&lt;-sum((x%*%solve((t(x)%*%x+k
               <em class="d4pbbc-italic">
               </em>
               *diag(m)))%*%t(x)%*%y-mean(y))^2)
               <br/>
               sst&lt;-sum((y-mean(y))^2)
               <br/>
               Rs&lt;-c(Rs,ssr/(sst))
               <br/>
               CID&lt;-c(CID,sqrt(max(b)/min(b)))##最大的那个条件数##
               <br/>
               }
               <br/>
               beta&lt;-as.data.frame(cbind(k,beta,Rs,CID))
               <br/>
               beta
               <br/>
               }
               <br/>
               test&lt;-function(y,x,k)##选定k值后的检验##
               <br/>
               {
               <br/>
               m&lt;-length(diag(t(x)%*%x))
               <br/>
               beta&lt;-solve((t(x)%*%x+k*diag(m)))%*%t(x)%*%y
               <br/>
               beta1&lt;-solve((t(x)%*%x))%*%t(x)%*%y
               <br/>
               a&lt;-solve((t(x)%*%x+k*diag(m)))%*%t(x)%*%x%*%solve(t(x)%*%x+k*diag(m))
               <br/>
               b&lt;-sqrt(diag(a))
               <br/>
               df&lt;-length(y)-length(x[1,])-1
               <br/>
               deta&lt;-sqrt(sum((y-x%*%beta1)^2)/df)
               <br/>
               tvalue&lt;-beta/deta/b
               <br/>
               ssr&lt;-sum((x%*%beta-mean(y))^2)
               <br/>
               sst&lt;-sum((y-mean(y))^2)
               <br/>
               Rs&lt;-ssr/(sst)
               <br/>
               f&lt;-ssr/length(x[1,])/(sst-ssr)*df
               <br/>
               p1&lt;-2*pt(abs(tvalue),df,lower.tail =F)
               <br/>
               p2&lt;-c(f,pf(f,length(x[1,]),df,lower.tail =F))
               <br/>
               output&lt;-rbind(t(beta),t(tvalue),t(p1))
               <br/>
               rownames(output)&lt;-c(“coef”,”t.value”,”p”)
               <br/>
               list(coef=output,f.value=p2,Rsquared=Rs)
               <br/>
               }
               <br/>
               trans&lt;-function(stat,key,a)##改变一下数据组织形式，便于作图##
               <br/>
               {
               <br/>
               n&lt;-length(a)
               <br/>
               m&lt;-nrow(stat)
               <br/>
               new&lt;-NULL
               <br/>
               for(i in 1:n)
               <br/>
               {
               <br/>
               betaname&lt;-rep(names(stat)[a
               <em class="d4pbbc-italic">
               </em>
               ],m)
               <br/>
               k&lt;-cbind(betaname,stat[,c(key,a
               <em class="d4pbbc-italic">
               </em>
               )])
               <br/>
               names(k)&lt;-c(“betaname”,names(stat)[key],”coeff”)
               <br/>
               new&lt;-rbind(new,k)
               <br/>
               }
               <br/>
               new
               <br/>
               }
               <br/>
               a&lt;-read.table(“7.7.txt”,head=T)
               <br/>
               a&lt;-scale(a)
               <br/>
               a&lt;-as.data.frame(a)
               <br/>
               y&lt;-as.vector(a[,2])
               <br/>
               x&lt;-as.matrix(a[,3:6])
               <br/>
               ri&lt;-ridge(y,x,0,1,0.05)
               <br/>
               ridge1&lt;-trans(ri,1,2:5)
               <br/>
               library(ggplot2)
               <br/>
               p&lt;-ggplot(ridge1,aes(y=coeff,x=k,group=betaname,colour=betaname))
               <br/>
               p+geom_point()
              </p>
              <p>
               输出结果：
              </p>
              <p>
               k        x1        x2         x3         x4        Rs      CID
              </p>
              <p>
               1  0.00 0.8913132 0.2598167 0.03447096 -0.3249237 0.7976040 1.679506
              </p>
              <p>
               2  0.05 0.8813761 0.2615524 0.03823029 -0.3201358 0.7936289 1.664367
              </p>
              <p>
               3  0.10 0.8717324 0.2632158 0.04185005 -0.3154576 0.7897716 1.649607
              </p>
              <p>
               4  0.15 0.8623690 0.2648101 0.04533714 -0.3108851 0.7860257 1.635214
              </p>
              <p>
               5  0.20 0.8532735 0.2663383 0.04869801 -0.3064143 0.7823853 1.621174
              </p>
              <p>
               6  0.25 0.8444344 0.2678036 0.05193871 -0.3020415 0.7788448 1.607475
              </p>
              <p>
               7  0.30 0.8358408 0.2692085 0.05506495 -0.2977632 0.7753991 1.594107
              </p>
              <p>
               8  0.35 0.8274823 0.2705559 0.05808207 -0.2935761 0.7720435 1.581056
              </p>
              <p>
               9  0.40 0.8193492 0.2718481 0.06099511 -0.2894768 0.7687733 1.568314
              </p>
              <p>
               10 0.45 0.8114323 0.2730874 0.06380882 -0.2854625 0.7655845 1.555869
              </p>
              <p>
               11 0.50 0.8037228 0.2742762 0.06652766 -0.2815303 0.7624731 1.543712
              </p>
              <p>
               12 0.55 0.7962125 0.2754165 0.06915586 -0.2776773 0.7594355 1.531834
              </p>
              <p>
               13 0.60 0.7888937 0.2765103 0.07169740 -0.2739010 0.7564681 1.520225
              </p>
              <p>
               14 0.65 0.7817588 0.2775594 0.07415603 -0.2701990 0.7535679 1.508877
              </p>
              <p>
               15 0.70 0.7748008 0.2785658 0.07653532 -0.2665687 0.7507317 1.497782
              </p>
              <p>
               16 0.75 0.7680132 0.2795310 0.07883862 -0.2630081 0.7479567 1.486931
              </p>
              <p>
               17 0.80 0.7613895 0.2804568 0.08106912 -0.2595148 0.7452403 1.476317
              </p>
              <p>
               18 0.85 0.7549237 0.2813446 0.08322984 -0.2560869 0.7425799 1.465933
              </p>
              <p>
               19 0.90 0.7486101 0.2821959 0.08532364 -0.2527223 0.7399732 1.455771
              </p>
              <p>
               20 0.95 0.7424432 0.2830121 0.08735321 -0.2494192 0.7374178 1.445826
              </p>
              <p>
               21 1.00 0.7364178 0.2837945 0.08932115 -0.2461757 0.7349118 1.436090
              </p>
              <p>
               四、MASS包
              </p>
              <p>
               library(MASS)
               <br/>
               lm.r&lt;-lm.ridge(y~x1+x2+x3+x4,data=a,lambda=seq(0,1,0.05))
               <br/>
               coef&lt;-as.data.frame(cbind(seq(0,1,0.05),t(lm.r$coef)))
               <br/>
               names(coef)[1]&lt;-c(“k”)
               <br/>
               ridge2&lt;-trans(coef,1,2:5)
               <br/>
               p&lt;-ggplot(ridge2,aes(y=coeff,x=k,group=betaname,colour=betaname))
               <br/>
               p+geom_point()
              </p>
              <p>
               输出：
              </p>
              <p>
               k        x1        x2         x3         x4
               <br/>
               0.00 0.00 0.8733050 0.2545673 0.03377450 -0.3183590
              </p>
              <p>
               0.05 0.05 0.8639525 0.2562014 0.03731322 -0.3138533
              </p>
              <p>
               0.10 0.10 0.8548654 0.2577699 0.04072565 -0.3094469
              </p>
              <p>
               0.15 0.15 0.8460324 0.2592758 0.04401780 -0.3051362
              </p>
              <p>
               0.20 0.20 0.8374426 0.2607218 0.04719530 -0.3009178
              </p>
              <p>
               0.25 0.25 0.8290859 0.2621105 0.05026344 -0.2967884
              </p>
              <p>
               0.30 0.30 0.8209528 0.2634443 0.05322722 -0.2927450
              </p>
              <p>
               0.35 0.35 0.8130342 0.2647255 0.05609133 -0.2887845
              </p>
              <p>
               0.40 0.40 0.8053216 0.2659562 0.05886023 -0.2849043
              </p>
              <p>
               0.45 0.45 0.7978067 0.2671386 0.06153808 -0.2811016
              </p>
              <p>
               0.50 0.50 0.7904819 0.2682746 0.06412885 -0.2773739
              </p>
              <p>
               0.55 0.55 0.7833400 0.2693661 0.06663627 -0.2737187
              </p>
              <p>
               0.60 0.60 0.7763739 0.2704148 0.06906388 -0.2701339
              </p>
              <p>
               0.65 0.65 0.7695771 0.2714224 0.07141503 -0.2666171
              </p>
              <p>
               0.70 0.70 0.7629434 0.2723905 0.07369289 -0.2631663
              </p>
              <p>
               0.75 0.75 0.7564668 0.2733206 0.07590045 -0.2597794
              </p>
              <p>
               0.80 0.80 0.7501416 0.2742143 0.07804057 -0.2564546
              </p>
              <p>
               0.85 0.85 0.7439625 0.2750727 0.08011596 -0.2531899
              </p>
              <p>
               0.90 0.90 0.7379242 0.2758973 0.08212917 -0.2499836
              </p>
              <p>
               0.95 0.95 0.7320220 0.2766894 0.08408265 -0.2468341
              </p>
              <p>
               1.00 1.00 0.7262511 0.2774500 0.08597871 -0.2437397
              </p>
              <p>
               这尼玛怎么搞，我该信哪个？这也太坑爹了，http://bbs.pinggu.org/thread-1099110-1-1.html，http://bbs.pinggu.org/thread-1099110-1-1.html这两位兄弟貌似也是，SPSS的语法我又看不懂，不知道有没有哪位会的可以指导指导。说实话岭回归我是没搞明白，好处我是懂的，MSE变小了。关键是差异太大了，也不知道，实践中人们到底是怎么运用的。但是我手写的用的就是书上的算法，和原创作者的也一致，这是为什么？其实最后用R做的两个挺相近的，差别不是很大，我看有帖子说R的较优，而且SPSS里面做出来的两种方法自身差异都很大，我表示怀疑。期望有大神能解决这个问题。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-341865">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2013年1月22日 下午12:11
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108769/#post-341865">
               2 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-341865 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108769 bbp-reply-position-2 user-id-378673 post-341865 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378673/" rel="nofollow" title="查看newbye的档案">
               <img src="http://sdn.geekzu.org/avatar/5737281bd214ec4b7ed0a49712a42843?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378673/" rel="nofollow" title="查看newbye的档案">
               newbye
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               [s:14]曾经用SPSS和R分别作因子分析，结果也是有出入，等楼下高人回答
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-341915">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2013年1月23日 下午1:38
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108769/#post-341915">
               3 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-341915 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108769 bbp-reply-position-3 user-id-373274 post-341915 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/373274/" rel="nofollow" title="查看zhaoys02的档案">
               <img src="http://sdn.geekzu.org/avatar/bc56e558d090452443e1465dee7800b9?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/373274/" rel="nofollow" title="查看zhaoys02的档案">
               zhaoys02
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               我个人觉得，可能是步长设置方式lamda不同，因为有些文献用的是lamda平方,有的是用1/lamda.
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-348224">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2013年6月3日 上午9:59
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108769/#post-348224">
               4 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-348224 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108769 bbp-reply-position-4 user-id-380287 post-348224 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/380287/" rel="nofollow" title="查看sonicworm的档案">
               <img src="http://sdn.geekzu.org/avatar/2cb0958d4b6f968785aa465f64f5ba98?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/380287/" rel="nofollow" title="查看sonicworm的档案">
               sonicworm
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               看了结果，可能还有个原因，有的方法默认将数据标准化，有的方法没有
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
           </li>
           <!-- .bbp-body -->
           <li class="bbp-footer">
            <div class="bbp-reply-author">
             作者
            </div>
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-footer -->
          </ul>
          <!-- #topic-108769-replies -->
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 4 个帖子 - 1 到 4（总计 4 个）
           </div>
           <div class="bbp-pagination-links">
           </div>
          </div>
          <div class="bbp-no-reply" id="no-reply-108769">
           <div class="bbp-template-notice">
            <p>
             您必须先登录才能回复该主题。
            </p>
           </div>
          </div>
         </div>
        </div>
        <!-- .entry-content -->
        <footer class="entry-meta">
        </footer>
        <!-- .entry-meta -->
       </article>
       <!-- #post -->
       <div class="comments-area" id="comments">
       </div>
       <!-- #comments -->
      </div>
      <!-- #content -->
     </div>
     <!-- #primary -->
     <div class="sidebar-container" id="tertiary" role="complementary">
      <div class="sidebar-inner">
       <div class="widget-area">
        <aside class="widget bbp_widget_login" id="bbp_login_widget-2">
         <h3 class="widget-title">
          登录
         </h3>
         <form action="http://cos.name/cn/wp-login.php" class="bbp-login-form" method="post">
          <fieldset>
           <legend>
            登录
           </legend>
           <div class="bbp-username">
            <label for="user_login">
             用户名:
            </label>
           </div>
           <div class="bbp-password">
            <label for="user_pass">
             密码:
            </label>
           </div>
           <div class="bbp-remember-me">
            <label for="rememberme">
             记住用户名
            </label>
           </div>
           <div class="bbp-submit-wrapper">
            <button class="button submit user-submit" id="user-submit" name="user-submit" tabindex="104" type="submit">
             登录
            </button>
           </div>
           <div class="bbp-login-links">
            <a class="bbp-register-link" href="http://cos.name/cn/wp-login.php?action=register" title="注册">
             注册
            </a>
            <a class="bbp-lostpass-link" href="http://cos.name/cn/wp-login.php?action=lostpassword" title="忘记密码">
             忘记密码
            </a>
           </div>
          </fieldset>
         </form>
        </aside>
        <aside class="widget widget_text" id="text-7">
         <h3 class="widget-title">
          搜索
         </h3>
         <div class="textwidget">
          <form action="http://www.google.com/search" id="bbp-search-form" method="get" onsubmit="Gsitesearch(this)" role="search">
           <div>
           </div>
          </form>
          <form id="bbp-search-form-baidu" onsubmit="g(this)" role="search">
           <div>
           </div>
          </form>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-2">
         <h3 class="widget-title">
          新鲜事
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <a href="http://cos.name/cn/topics/">
             最新帖子
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/popular/">
             最热门主题
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/no-replies/">
             消灭零回复
            </a>
           </li>
          </ul>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-3">
         <h3 class="widget-title">
          RSS订阅
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/topics/feed/">
             所有主题
            </a>
           </li>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/forums/feed/">
             所有帖子
            </a>
           </li>
          </ul>
         </div>
        </aside>
       </div>
       <!-- .widget-area -->
      </div>
      <!-- .sidebar-inner -->
     </div>
     <!-- #tertiary -->
    </div>
    <!-- #main -->
    <footer class="site-footer" id="colophon" role="contentinfo">
     <div class="site-info">
      版权所有 © 2014 统计之都 | 由
      <a href="http://wordpress.org/">
       WordPress
      </a>
      构建 | 主题修改自
      <a href="http://wordpress.org/themes/twentythirteen">
       Twenty Thirteen
      </a>
     </div>
     <!-- .site-info -->
    </footer>
    <!-- #colophon -->
   </div>
   <!-- #page -->
  </div>
 </body>
</html>